package com.yan.demo.array;

public class ArrayDemo2 {
    public static void main(String[] args) {
        int[] arr = {5, 12, 90, 18, 77, 76, 45, 28, 59, 72};
        int num = 59;
        int index = -1;
        for (int i = 0; i < arr.length; i++) {
            if (num == arr[i]){
                index = i;
            }
        }
        if (index != -1) {
            System.out.println("index = " + index);
        } else {
            System.out.println("查不到这个数据");
        }
    }

}
